import React from 'react';
import { get } from 'lodash';
import { useToggle } from 'react-use';
import { Modal, Button, Nav } from 'react-bootstrap';

const InsuranceNotification = ({ product }) => {
  const [visible, toggle] = useToggle(false);

  return (
    <div>
      <Nav.Link onClick={toggle}>查看客户告知书</Nav.Link>
      <Modal show={visible} onHide={toggle}>
        <Modal.Header closeButton>
          <Modal.Title>客户告知书</Modal.Title>
        </Modal.Header>

        <Modal.Body>
          <p>{get(product, 'description')}</p>
        </Modal.Body>

        <Modal.Footer>
          <Button variant="primary" onClick={toggle}>
            确定
          </Button>
        </Modal.Footer>
      </Modal>
    </div>
  );
};

export default InsuranceNotification;
